<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>发表书评</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="author" content="夜读书">
    <meta name="description" content="夜读书中文网">
    <meta name="keywords" content="读书,阅读,小说,文学">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="{{ asset('/bootstrap-3.3.5-dist/css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ asset('/style/css/yds.css') }}">
    <link rel="stylesheet" href="{{ asset('/style/css/ucenter.css') }}">
    <script src="{{ asset('/scripts/jquery/jquery-1.11.3.min.js') }}"></script>
    <script src="{{ asset('/bootstrap-3.3.5-dist/js/bootstrap.min.js') }}"></script>
    {{-- umeditor --}}
    <script type="text/javascript" charset="utf-8" src="{{ asset('/editor/review_ueditor1_4_3_1/ueditor.config.js') }}"></script>
    <script type="text/javascript" charset="utf-8" src="{{ asset('/editor/review_ueditor1_4_3_1/ueditor.all.js') }}"> </script>
    <script type="text/javascript" charset="utf-8" src="{{ asset('/editor/review_ueditor1_4_3_1/lang/zh-cn/zh-cn.js') }}"></script>
    {{-- umeditor end--}}
</head>
<body>
@include('books.partials.navtop')
@include('books.partials.nav')
<div id="yds_screen">
<div id="yds_content" class="clearfix">
  <div class="article">
   <h1>评论 {{ $books->book_name }}</h1>
    <form name="form" class="form-horizontal" role="form" method="post" action="{{url('savebookreview')}}" enctype="multipart/form-data" onkeydown="if(event.keyCode==13){return false;}">
     <input type="hidden" name="_token" value="{{ csrf_token() }}" />
     <input type="hidden" name="bookid" id="bookid" value="{{$books->book_id}}">
     <label for="title" class="">书评标题：</label>
    <div class="form-group">      
      <div class="col-sm-10"  style="width:100%">
        <input type="text" class="form-control" name="title" id="title" value="" maxlength="50" />
      </div>
    </div>
    <div class="radio">
    <span for="title" class="">评分：</span>
      <label>
        <input type="radio" name="rating" id="rating" value="1">很差
      </label>
      <label>
        <input type="radio" name="rating" id="rating" value="2">较差 
      </label>
      <label>
        <input type="radio" name="rating" id="rating" value="3">还行
      </label>
      <label>
        <input type="radio" name="rating" id="rating" value="4">推荐
      </label>
      <label>
        <input type="radio" name="rating" id="rating" value="5">力荐
      </label>
    </div>
    <label for="bookreview" class="" style="margin-top:15px">正文:</label>
    <div class="form-group">      
      <div class="col-sm-10" style="width:100%">
        <script type="text/plain" id="bookreview" name="bookreview" style="height:400px;"></script>
      </div>
    </div>       
      <div>
        <div class="mod-body-button">
          <span class="ms"></span><button type="button" id="okbutton" class="btn btn-success" style="float:right">发表书评</button>
        </div>
      </div>
    <script type="text/javascript">
    //实例化编辑器
    var bookreview = UE.getEditor('bookreview');
    </script>
    </form>
  </div>
  <div class="aside">
  <div class="indent">
    <p>请尊重创作者的劳动，勿提供下载信息、或转载他人的文章。</p>
    <span class="">提示...</span>
    <p>为了鼓励有益的长书评, 少于350字的评论请到短评页中发表。</p>
  </div>
  <div class="pl2"><a href="{{url('info')}}/{{$books->book_id}}">{{$books->book_name}}</a></div>
  <div class="rebook">
    <a href="{{url('info')}}/{{$books->book_id}}"><img src="{{url($books->bimg)}}"></img></a>
    <br/>
    @if($books->zuozhe!="") <span class="p1">作者:{{ $books->zuozhe }}</span><br/> @endif
    @if($books->yuanzuoming!="") <span class="p1">原作名:{{ $books->yuanzuoming }}</span><br/> @endif
    @if($books->isbn!="") <span class="p1">isbn:{{ $books->isbn }}</span><br/> @endif
    @if($books->book_name!="") <span class="p1">书名:{{ $books->book_name }}</span><br/> @endif
    @if($books->yeshu!="") <span class="p1">页数:{{ $books->yeshu }}</span><br/> @endif
    @if($books->yizhe!="") <span class="p1">译者:{{ $books->yizhe }}</span><br/> @endif
    @if($books->dingjia!="") <span class="p1">定价:{{ $books->dingjia }}</span><br/> @endif
    @if($books->chubanshe!="") <span class="p1">出版社:{{ $books->chubanshe }}</span><br/> @endif
    @if($books->zhuangzhen!="") <span class="p1">装帧:{{ $books->zhuangzhen }}</span><br/> @endif
    @if($books->chubannian!="") <span class="p1">出版年:{{ $books->chubannian }}</span><br/> @endif
  </div>
  </div>
</div>
</div>
<script>
$(document).ready(function(){
    $("#okbutton").click(function(){
        if($.trim($("#title").val())=="")
        {
            $(".ms").html("<font color='red'>请给书评起个标题。</font>");
        }
        else if($('input:radio[name="rating"]:checked').val()==null) //判断radio是否已经打勾
        {
            $(".ms").html("<font color='red'>请给本书评分。</font>");
        }
        else if((UE.getEditor('bookreview').getContentTxt()).length<350)
        {
            $(".ms").html("<font color='red'>长评读后感不要少于350字，短评请到书籍信息页评论。</font>");
        }
        else if((UE.getEditor('bookreview').getContentTxt()).length>5000)
        {
            $(".ms").html("<font color='red'>不要多于5000字符。</font>");
        }
        else
        {
            form.submit();
        }
    });
});
</script>
@include('books.partials.footer')
</body>
</html>
